package com.campus_assistant.service.db1;

import com.alibaba.fastjson.JSON;
import com.campus_assistant.mapper.db1.ScoresMapper;
import com.campus_assistant.pojo.db1.Courses;
import com.campus_assistant.pojo.db1.Scores;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;

@Service
public class ScoresServiceImpl implements ScoresService {
    @Autowired
    private ScoresMapper scoresMapper;
    @Autowired
    private RestHighLevelClient restHighLevelClient;
    @Override
    public int addScores(Scores scores) {

        return scoresMapper.addScores(scores);
    }

    @Override
    public int deleteScores(int sid, int cid) {

        return scoresMapper.deleteScores(sid,cid);
    }


    @Override
    public int updateScores(Scores scores) {

        return scoresMapper.updateScores(scores);
    }

    @Override
    public List<Scores> selectAll() {
        return scoresMapper.selectAll();
    }

    @Override
    public List<Scores> getScoreBysId(int sId) {
        return scoresMapper.getScoreBysId(sId);
    }

    @Override
    public String getCourseNameBycId(int cId) {
        return scoresMapper.getCourseNameBycId(cId);
    }

    @Override
    public List<Integer> getAllSid() {
        return scoresMapper.getAllSid();
    }

    @Override
    public List<Integer> getCidBySid(int sid) {
        return scoresMapper.getCidBySid(sid);
    }


}
